<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台管理</title>
<link href="__PUBLIC__/ht/css/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/ht/js/jquery.js"></script>
<style>
.dx1{float:left; margin-left: 17px; margin-bottom:10px; }
.dx2{color:#090; font-size:16px;  border-bottom:1px solid #CCC; width:100% !important; padding-bottom:8px;}
.dx3{width:120px; margin:5px auto; border-radius: 2px; border: 1px solid #b9c9d6; display:block;}
.dx4{border-bottom:1px solid #eee; padding-top:5px; width:100%;}

.img-add {
    position: relative;
    color: white;
    font-size: 20px;
    border-radius: 16px;
    background: #c00;
    height: 21px;
    width: 21px;
    text-align: center;
    line-height: 20px;
    cursor:pointer;
    margin-left: 5px;
    font-weight: bold;
}

.img-jian {
    position: relative;
    color: white;
    font-size: 20px;
    border-radius: 16px;
    background: gray;
    height: 21px;
    width: 21px;
    text-align: center;
    line-height: 20px;
    cursor:pointer;
    margin-left: 5px;
    font-weight: bold;
}
</style>
</head>
<body>

<div class="aaa_pts_show_1">【 产品管理 】</div>

<div class="aaa_pts_show_2">
    <div>
       <div class="aaa_pts_4"><a href="{:U('set_attr')}?pid={$pro_id}">设置规格</a></div>
       <div class="aaa_pts_4"><a href="{:U('pro_guige')}?pid={$pro_id}">规格管理</a></div>
       <!-- <div class="aaa_pts_4"><a href="{:U('pro_attr')}?pid={$pro_id}">属性组合管理</a></div> -->
    </div>
    <div class="aaa_pts_3">
      <form action="{:U('save_guide')}" method="post" onsubmit="return ac_from();">
      <ul id="ul" class="aaa_pts_5">
        <li class="product"><div class="d1 dx2">产品信息</div></li>
        <li class="product">
            <div class="d1">产品名称:</div>
            <div>
              <span style="font-weight:bold;">{$pro_info.name}</span>
            </div>
         </li>
         <li class="product">
            <div class="d1">产品价格:</div>
            <div>
              <span style="font-weight:bold; color:red;">¥{$pro_info.price_yh}元</span>
            </div>
         </li>
         <li class="product">
            <div class="d1">库&nbsp;&nbsp;存:</div>
            <div>
              <span style="font-weight:bold; color:red;">{$pro_info.num}</span>
            </div>
         </li>
         <li class="product"><div class="d1 dx2">属性规格信息</div></li>
         <volist name="guige_list" id="v">
         <li>
            <div class="d1">{$v.attr_name}:</div>
            <input type="hidden" name="attr_id" id="attr_id" value="{$v.attr_id}">
            <div>
              <volist name="v['guige_list']" id="vs">
                <input type="hidden" name="guige_id" id="guige_id" value="{$vs.id}" />
                <label style="font-weight:bold;">【{$vs.name}】</label>
              </volist>
            </div>
         </li>
         </volist>
         <li class="product"><div class="d1 dx2">属性规格设置</div></li>
         <li>
            <div class="d1">选择属性:</div>
            <div>
                <volist name="attr_list" id="list">
                  &nbsp;&nbsp;&nbsp; <input type="checkbox" name="attribute[]" id="{$list.id}" value="{$list.id}" onchange="chk_info({$list.id},'{$list.attr_name}');" />&nbsp;<label style="font-weight:bold;">{$list.attr_name}</label>
                </volist>
            </div>
         </li>
         <li id="guige">
            <!-- <div class="d1">规  格:</div>
            <div id="divs">
              <input class="inp_1" style="width:100px;" name="gg_name[]" value="" />
            </div>&nbsp;&nbsp;
            <div class="img-jian" id="jiangg" onclick="jian(this);">－</div>
            <div class="img-add" onclick="upadd(this);">＋</div> -->
         </li>
         <li><input type="submit" name="submit" value="提交" class="aaa_pts_web_3" border="0">
         	<input type="hidden" name="pro_id" value="<?php echo $pro_id; ?>">
          <input type="hidden" name="set_attrid" id="set_attrid" value="">
         </li>
      </ul>
      </form>
         
    </div>
    
</div>
<script>
function chk_info(chk_id,chk_name){
  var checkbox = $("input[name='attribute[]']:checked").length;
    if (checkbox>4) {
      alert('最多只能选四个产品属性.');
      document.getElementById(chk_id).checked=false;
      return false;
    };
   
  if (document.getElementById(chk_id).checked) {
    var info = '<div id=div_'+chk_id+' style="clear:both;margin-bottom:5px;"><div class="d1">'+chk_name+'：</div><div id="inp_'+chk_id+'"><input class="inp_1" name="gg_name['+chk_id+'][]" style="width:80px;" value=""/></div>&nbsp;&nbsp;<div class="img-jian" id="jiangg" onclick="jian(\''+chk_id+'\');">－</div><div class="img-add" onclick="upadd(\''+chk_id+'\');">＋</div></div>';
    $('#guige').append(info);
  }else{
    document.getElementById("div_"+chk_id).remove();
  }
}

function upadd(chk_id){
  var info = '<input class="inp_1" name="gg_name['+chk_id+'][]" style="width:80px;margin-left:3px;" value=""/>';
  $("#inp_"+chk_id).append(info);
  var radio_val = $("input[name='is_price']:checked").val();
  if (radio_val==chk_id) {
    chk_radio(chk_id);
  };
}

function jian(chk_id){
  $("#inp_"+chk_id+' :last-child').remove();
  var radio_val = $("input[name='is_price']:checked").val();
  if (radio_val==chk_id) {
    chk_radio(chk_id);
  };
}

function clearprov(obj){
  $(obj).parent().html('');
}

function ac_from(){
  //判断栏目名称
  /*var attr_name=document.getElementById('attr_name').value;
  if(attr_name.length<1){
	  alert('请输入属性名称.');
	  return false;
	  }*/

  return true;
}
</script>
</body>
</html>